package zemberek3.lexicon;

import zemberek3.structure.IdItem;

/**
 * Represents one of the lexical form of a suffix.
 * This class does not contain information about the morphotactics.
 */
public class LexicalForm extends IdItem {

    public final Suffix suffix;  // parent suffix
    public final String form;    // form String that is used for generating surface froms for this lexical form.
    public final boolean empty;  // if this has an empty lex form.

    public LexicalForm(String id, Suffix suffix, String form) {
        this.id = id;
        this.suffix = suffix;
        this.form = form;
        this.empty = form.length() == 0;
    }

    public LexicalForm(String id, Suffix suffix) {
        this(id, suffix, "");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LexicalForm lexicalForm = (LexicalForm) o;

        return id.equals(lexicalForm.id);

    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String getId() {
        return id;
    }
}
